package com.example.basefream.config;

import com.ctrip.framework.apollo.openapi.client.ApolloOpenApiClient;
import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig;
import lombok.Data;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：Mr-L
 * @date ：Created in 2022/4/13 12:09
 * @description：apollo 的openApi
 * @modified By：
 * @version: $
 */
@Configuration
@EnableApolloConfig
@Data
public class ApolloAutoConfig {
    String portalUrl = "http://10.10.87.141:8070"; // portal url
    String token = "f52913cb6bca4b39385489917a5a3f9d25fd4333"; // 申请的token

    @Bean
    public DevConfig appConfig() {
        return new DevConfig();
    }

    @Bean
    public ApolloOpenApiClient apolloOpenApiClient() {
        ApolloOpenApiClient client = ApolloOpenApiClient.newBuilder()
                .withPortalUrl(portalUrl)
                .withToken(token)
                .build();
        return client;
    }
}

